cmake_minimum_required(VERSION 3.15)
project(abc-aop)

# Default to Debug to improve editor IntelliSense when unspecified
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build: Debug, Release, RelWithDebInfo, MinSizeRel" FORCE)
endif()

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(CMAKE_C_COMPILER "C:/Users/tao/AppData/Local/Microsoft/WinGet/Packages/BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe/mingw64/bin/gcc.exe")
set(CMAKE_CXX_COMPILER "C:/Users/tao/AppData/Local/Microsoft/WinGet/Packages/BrechtSanders.WinLibs.POSIX.UCRT_Microsoft.Winget.Source_8wekyb3d8bbwe/mingw64/bin/g++.exe")

if(WIN32)
    set(PLATFORM "Windows")
    # thirdparty folder naming uses lowercase
    set(PLATFORM_DIR "windows")
    set(ARCH "x64")
elseif(APPLE)
    set(PLATFORM "macOS")
    # thirdparty folder naming uses lowercase
    set(PLATFORM_DIR "macos")
    set(ARCH "arm64")
endif()

message(STATUS "Building for ${PLATFORM}/${ARCH}")

set(THIRDPARTY_DIR "${CMAKE_SOURCE_DIR}/thirdparty")
set(INCLUDE_DIR "${THIRDPARTY_DIR}/include")
set(LIB_DIR "${THIRDPARTY_DIR}/${PLATFORM_DIR}/${ARCH}")

set(ABCKIT_LIB "${LIB_DIR}/libabckit.lib")
set(ARK_ASSEMBLER_LIB "${LIB_DIR}/libarkassembler.lib")

if(EXISTS ${ABCKIT_LIB})
    message(STATUS "Found abckit library: ${ABCKIT_LIB}")
else()
    message(WARNING "libabckit.lib not found in ${ABCKIT_LIB}")
endif()

if(EXISTS ${ARK_ASSEMBLER_LIB})
    message(STATUS "Found arkassembler library: ${ARK_ASSEMBLER_LIB}")
else()
    message(WARNING "libarkassembler.lib not found in ${ARK_ASSEMBLER_LIB}")
endif()

include_directories(${INCLUDE_DIR})

add_subdirectory(src)